package com.museum.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.museum.entity.Reservation;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * 预约表Mapper接口
 */
@Mapper
public interface ReservationMapper extends BaseMapper<Reservation> {
    
    /**
     * 获取热门参观日期数据
     * @return 热门日期数据，包含日期和预约人数
     */
    @Select("SELECT visit_date as name, SUM(visitor_count) as value " +
            "FROM reservation " +
            "WHERE status != 2 " +
            "GROUP BY visit_date " +
            "ORDER BY value DESC " +
            "LIMIT 10")
    List<Map<String, Object>> getPopularDates();
} 